<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <form action="{:U('Common/addCommon')}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">上级分类</label>
            <div class="controls">
            <select name="pid">
                <option value="0" selected="">顶级分类</option>
                <volist name="_class" id="v">
                    <option value="{$v.id}" <if condition="$v['id'] eq $pid">selected="selected"<elseif condition="($data['pid'] gt 0) and ($v['id'] eq $data['pid'])" />selected="selected"</if>>{$v.name}</option>          
                </volist>
            </select>               
            </div>
        </div>
        <div class="form-item">
            <label class="item-label"><eq name="pid" value="0">标题<else />选项值</eq></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="{$data.name|default=''}">
            </div>
        </div>
        <eq name="pid" value="0">
            <div class="form-item">
                <label class="item-label">类型</label>
                <div class="controls">
                    <select name="type">
                        <option value="0" selected="">--请选择--</option>
                        <option value="1" <if condition="$data['type'] eq 1">selected="selected"</if>>文本框</option>
                        <option value="2" <if condition="$data['type'] eq 2">selected="selected"</if>>选择框</option>
                    </select>       
                </div>
            </div>
        </eq>
        <div class="form-item">
            <input type="hidden" name="table" value="goods_info">
            <input type="hidden" name="methods" value="GoodsInfo">
            <eq name="pid" value="0">
                <input type="hidden" name="son_methods" value="index">
            <else />
                <input type="hidden" name="son_methods" value="son_index">
            </eq>
            <input type="hidden" name="fields" value="pid,text;name,text;type,text">
            <input type="hidden" name="id" value="{$data.id|default=0}">
            <input type="hidden" name="params" value="id,{$pid}">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('GoodsClass/index')}');
    </script>
</block>
